import React from 'react';
import {Link} from "react-router-dom";
import {Button} from "antd";
import GUtils from "@/utils";

const Config = (Action) => {

    const columns = [
       
        {title:"UID",dataIndex:"userId",width:80, render(v, vo){
            let uid = GUtils.renderUID(v);
            return  <a>{uid}</a>
        }},
        {title:"手机号",dataIndex:"userPhone",width:120},
        {title:"昵称",dataIndex:"userNickname",width:120},
        {title:"可用余额",dataIndex:"totalAmountAfter",width:120, render:v=>GUtils.renderAmount(v)},
        {title:"类型",dataIndex:"referenceType",width:120, render:v=>GUtils.dealEnumValue(v,"BalanceReferenceType")},
        {title:"订单号",dataIndex:"referenceNumber",width:180, render(v, vo){
            let page ="";
            if(vo.referenceType == 1){
                page = window.CONFIG.PAGE_RECHARGE_ORDER
            }else{
                page = window.CONFIG.PAGE_WASH_ORDER
            }
            return <Link to={`${page}${window.CONFIG.PAGE_DETAIL}?id=${vo.referenceId}`}>{v}</Link>
        }},
        {title:"说明",dataIndex:"eventType",width:120, render:v=> GUtils.dealEnumValue(v, "UserBalanceEventType")},
        {title:"变动金额",dataIndex:"amount",width:120, render:v=> v>0?"+"+v:v},
        {title:"变动时间",dataIndex:"createTime",width:180, render:v=>GUtils.dateTimeFormatter(v)},
    ];
    return {
        ...window.CONFIG.getPagerConfig(Action), columns
    };
};


export default Config;
